import { Scene } from "../../../../../Core/Module/Entity/Scene";
import { SceneType } from "../../../../../Core/Module/Entity/SceneType";
import { ActorMessageHandlerAttribute } from "../../../../../Decorator/Decorator";
import { ObjectRemoveRequest, ObjectRemoveResponse } from "../../../../Model/Generate/Share/Message/InnerMessage_S_20001";
import { LocationComponent } from "../../../../Model/Server/Module/ActorLocation/LocationComponent";
import { AMActorRpcHandler } from "../Actor/AMActorRpcHandler";

@ActorMessageHandlerAttribute(SceneType.Location, ObjectRemoveRequest, ObjectRemoveResponse)
export class ObjectRemoveRequestHandler extends AMActorRpcHandler<Scene, ObjectRemoveRequest, ObjectRemoveResponse> {

    protected override async Run(scene: Scene, request: ObjectRemoveRequest, response: ObjectRemoveResponse): Promise<void> {
        await scene.GetComponent<LocationComponent>(LocationComponent).Remove(request.Key);
    }

}